package com.yq.day72;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * @author 3307235355@qq.com
 * @description
 * @since 2022/07/02 09:46
 */
public class ClassLoaderTest {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InstantiationException, InvocationTargetException {
        // 指定加载的路径
        String classPath = "D:\\HelloWord.class";
        //    创建自定义的类加载器
        Demo01 d1 = new Demo01(classPath);
        //    得到字节码文件对象
        Class<?> log = d1.loadClass("HelloWord");
        Method declaredMethod = log.getDeclaredMethod("func");
        Object o = log.newInstance();
        declaredMethod.invoke(o);
        //

    }
}
